﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.ComponentModel.Composition;
using System.Collections;
using Mysoft.ServerMonitoring.OMKit.TitleBar.ViewModels;
using ProjTemp.Desktop.Common.Controls;
using ProjTemp.Desktop.Common.View;

namespace Mysoft.ServerMonitoring.OMKit.TitleBar.Views
{
    /// <summary>
    /// Interaction logic for TitleBar.xaml
    /// </summary>
    [Export(typeof(TitleBar))]
    [PartCreationPolicy(CreationPolicy.NonShared)]
    public partial class TitleBar : VBase
    {
        public TitleBar()
        {
            InitializeComponent();

            this.IconListBox.AddHandler(UIElement.MouseDownEvent, new MouseButtonEventHandler(ListBox_MouseDown), true);
        }

        [Import]
        internal TitleBarViewModel ViewModel
        {
            get { return this.DataContext as TitleBarViewModel; }
            set { this.DataContext = value; }
        }

        private void ListBox_MouseDown(Object sender, MouseButtonEventArgs e)
        {
            if (this.ViewModel != null)
                this.ViewModel.RequestNavigation();
        }
    }
}
